require 'test_helper'


class MessageTest < ActiveSupport::TestCase
  setup do
    @client = clients :ircclient_a
  end


  test "should not save message with missing nick" do
    message = @client.room.messages.create MESSAGE_PARAMS_MISSING_NICK
    assert_not message.save
  end

  test "should not save message with empty nick" do
    message = @client.room.messages.create MESSAGE_PARAMS_EMPTY_NICK
    assert_not message.save
  end

  test "should not save message with missing text" do
    message = @client.room.messages.create MESSAGE_PARAMS_MISSING_TEXT
    assert_not message.save
  end

  test "should not save message with empty text" do
    message = @client.room.messages.create MESSAGE_PARAMS_EMPTY_TEXT
    assert_not message.save
  end

  test "should save message with valid params" do
    message = @client.room.messages.create MESSAGE_PARAMS_VALID
    assert message.save
  end
end
